<template>
    <div class="home">
        <div class="content">
            <div class="header">
                <div class="text">外卖</div>
                <div class="location">
                    <van-icon name="location-o" />
                    <span>砂糖橘村</span>
                    <van-icon name="arrow" />
                </div>
            </div>
            <div class="main">
                <div class="main-bg">
                    <div class="search">
                        <input type="text">
                        <div class="search-text">搜索</div>
                    </div>
                    <div class="sort">
                        <div class="big-sort">
                            <div v-for="(item,index) in big_sort" :key="index">
                                <svg class="icon" aria-hidden="true">
                                    <use :xlink:href="`#${item.icon}`"></use>
                                </svg>
                                {{item.name}}
                            </div>
                        </div>
                        <div class="small-sort">
                            <div v-for="(item,index) in small_sort" :key="index">
                                <svg class="icon" aria-hidden="true">
                                    <use :xlink:href="`#${item.icon}`"></use>
                                </svg>
                                {{item.name}}
                            </div>
                        </div>
                    </div>
                </div>
                <van-tabs class="van-tabs" v-model:active="active">
                    <van-tab v-for="(item, index) in content_nav_list" :key="index"
                        :title="item.tab"
                    >
                        <nav-list :navList="item.data"></nav-list>
                    </van-tab>
                </van-tabs>

            </div>
        </div>
        <Footer></Footer>
    </div>
</template>
<script>
import { reactive, toRefs, ref } from 'vue';
import Footer from '../../components/Footer.vue'
import NavList from '../../components/NavList.vue'
export default {
    components: {
        Footer,
        NavList,
    },
    setup(){
        let data = reactive({
            active: ref(0),
            big_sort: [
                {
                    name: "美食",
                    icon: "icon-meishi2"
                },
                {
                    name: "甜点",
                    icon: "icon-mbefengge_tiantianquan"
                },
                {
                    name: "超市便利",
                    icon: "icon-gouwudai1"
                },
                {
                    name: "生鲜果蔬",
                    icon: "icon-rou"
                },
                {
                    name: "买药",
                    icon: "icon-jiaonang1"
                },
            ],
            small_sort: [
                {
                    name: "午餐",
                    icon: "icon-jitui"
                },
                {
                    name: "买酒",
                    icon: "icon-jiushui1"
                },
                {
                    name: "新鲜水果",
                    icon: "icon-shuiguoshengxian"
                },
                {
                    name: "汉堡披萨",
                    icon: "icon-meishi"
                },
                {
                    name: "悠闲饮品",
                    icon: "icon-zhenzhunaicha"
                },
                {
                    name: "夜宵",
                    icon: "icon-yexiao"
                },
                {
                    name: "吐司",
                    icon: "icon-tusi"
                },
                {
                    name: "跑腿",
                    icon: "icon-_waimai"
                },
                {
                    name: "美丽佳人",
                    icon: "icon-kouhong"
                },
                {
                    name: "全部分类",
                    icon: "icon-kouhong"
                },
            ],
            content_nav_list: [
                {
                    tab: "天天神券",
                    data: [
                        {
                            pic: "",
                            title: "酸菜鱼",
                            sales: "2888",
                            price: "20",
                            label: ["门店上新", "很下饭"]
                        }
                    ]
                },
                {
                    tab: "减配送费",
                    data: []
                },
                {
                    tab: "点评高分",
                    data: []
                },
                {
                    tab: "会员满减",
                    data: []
                },
            ]
        })
        return {
            ...toRefs(data),
        }
    }
}
</script>
<style lang="less" scoped>
    .home{
        height: 100%;
        display: flex;
        flex-flow: column;
        .header{
            background-image: linear-gradient(#ffc400, #fff);
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 20px 20px 40px 20px;
            .text{
                font-size: 20px;
                font-weight: 600;
            }
            .location{
                font-size: 14px;
                span{
                    margin: 6px;
                }
            }
        }
        .content{
            flex: 1;
            overflow-y: auto;
            .main{
                margin-top: -30px;
                .main-bg{
                    background-image: linear-gradient(#fff, #f5f5f5);
                    border-radius: 30px 30px 0 0;
                    padding: 10px 20px 0;
                    .search{
                        position: relative;
                        input{
                            width: 100%;
                            border: 1px solid #ffc400;
                            border-radius: 20px;
                            height: 30px;
                            font-size: 14px;
                        }
                        .search-text{
                            position: absolute;
                            right: -6px;
                            top: 9px;
                            border-radius: 16px;
                            background-color: #ffc400;
                            width: 50px;
                            height: 33px;
                            line-height: 33px;
                            font-size: 14px;
                            text-align: center;
                            color: #fff;
                        }
                    }
                    .big-sort{
                        margin-top: 10px;
                        display: flex;
                        div{
                            display: flex;
                            flex: 1;
                            flex-flow: column;
                            align-items: center;
                            font-size: 14px;
                            margin-top: 5px;
                            .icon{
                                width: 50px;
                                height: 50px;
                                margin-bottom: 5px;
                                use{
                                    
                                font-size: 50px;
                                }
                            }
                        }
                    }
                    .small-sort{
                        margin-top: 8px;
                        display: flex;
                        flex-wrap: wrap;
                        div{
                            width: 20%;
                            display: flex;
                            flex-flow: column;
                            align-items: center;
                            font-size: 14px;
                            margin-top: 5px;
                            .icon{
                                width: 30px;
                                height: 30px;
                            }

                        }
                    }
                }
                .van-tabs{
                    padding: 10px 20px 0;
                }
            }
        }
    }
    /deep/ .van-tabs__wrap{
        border-radius: 10px;
    }
</style>